package cn.gson.springboot.model.pojos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Objects;

@Entity
@Table(name = "competitor_", schema = "crm")
public class Competitor {
    private int competitorId;
    private String competitorName;
    private BigDecimal competitorPrice;
    private Integer competitorCapacity;
    private String competitorProduct;
    private String competitorStrengths;
    private String competitorWeaknesses;
    private String competitorStrategy;
    private String competitorRemarks;
    private Opportunity opportunityByOppId;
    private Customer customerByCustomerId;

    @Id
    @Column(name = "competitor_id", nullable = false)
    public int getCompetitorId() {
        return competitorId;
    }

    public void setCompetitorId(int competitorId) {
        this.competitorId = competitorId;
    }

    @Basic
    @Column(name = "competitor_name", nullable = true, length = 255)
    public String getCompetitorName() {
        return competitorName;
    }

    public void setCompetitorName(String competitorName) {
        this.competitorName = competitorName;
    }

    @Basic
    @Column(name = "competitor_price", nullable = true, precision = 2)
    public BigDecimal getCompetitorPrice() {
        return competitorPrice;
    }

    public void setCompetitorPrice(BigDecimal competitorPrice) {
        this.competitorPrice = competitorPrice;
    }

    @Basic
    @Column(name = "competitor_capacity", nullable = true)
    public Integer getCompetitorCapacity() {
        return competitorCapacity;
    }

    public void setCompetitorCapacity(Integer competitorCapacity) {
        this.competitorCapacity = competitorCapacity;
    }

    @Basic
    @Column(name = "competitor_product", nullable = true, length = 255)
    public String getCompetitorProduct() {
        return competitorProduct;
    }

    public void setCompetitorProduct(String competitorProduct) {
        this.competitorProduct = competitorProduct;
    }

    @Basic
    @Column(name = "competitor_strengths", nullable = true, length = 255)
    public String getCompetitorStrengths() {
        return competitorStrengths;
    }

    public void setCompetitorStrengths(String competitorStrengths) {
        this.competitorStrengths = competitorStrengths;
    }

    @Basic
    @Column(name = "competitor_weaknesses", nullable = true, length = 255)
    public String getCompetitorWeaknesses() {
        return competitorWeaknesses;
    }

    public void setCompetitorWeaknesses(String competitorWeaknesses) {
        this.competitorWeaknesses = competitorWeaknesses;
    }

    @Basic
    @Column(name = "competitor_strategy", nullable = true, length = 255)
    public String getCompetitorStrategy() {
        return competitorStrategy;
    }

    public void setCompetitorStrategy(String competitorStrategy) {
        this.competitorStrategy = competitorStrategy;
    }

    @Basic
    @Column(name = "competitor_remarks", nullable = true, length = 255)
    public String getCompetitorRemarks() {
        return competitorRemarks;
    }

    public void setCompetitorRemarks(String competitorRemarks) {
        this.competitorRemarks = competitorRemarks;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Competitor that = (Competitor) o;
        return competitorId == that.competitorId &&
                Objects.equals(competitorName, that.competitorName) &&
                Objects.equals(competitorPrice, that.competitorPrice) &&
                Objects.equals(competitorCapacity, that.competitorCapacity) &&
                Objects.equals(competitorProduct, that.competitorProduct) &&
                Objects.equals(competitorStrengths, that.competitorStrengths) &&
                Objects.equals(competitorWeaknesses, that.competitorWeaknesses) &&
                Objects.equals(competitorStrategy, that.competitorStrategy) &&
                Objects.equals(competitorRemarks, that.competitorRemarks);
    }

    @Override
    public int hashCode() {
        return Objects.hash(competitorId, competitorName, competitorPrice, competitorCapacity, competitorProduct, competitorStrengths, competitorWeaknesses, competitorStrategy, competitorRemarks);
    }

    @ManyToOne
    @JoinColumn(name = "opp_id", referencedColumnName = "opp_id")
    public Opportunity getOpportunityByOppId() {
        return opportunityByOppId;
    }

    public void setOpportunityByOppId(Opportunity opportunityByOppId) {
        this.opportunityByOppId = opportunityByOppId;
    }

    @ManyToOne
    @JoinColumn(name = "customer_id", referencedColumnName = "customer_id")
    public Customer getCustomerByCustomerId() {
        return customerByCustomerId;
    }

    public void setCustomerByCustomerId(Customer customerByCustomerId) {
        this.customerByCustomerId = customerByCustomerId;
    }
}
